/*
 * Copyright © 2004-2014 chenYuan. All rights reserved.
 * @Website:wwww.jspx.net
 * @Mail:39793751@qq.com
 * @author: chenYuan , 陈原
 * @License: Jspx.net Framework Code is open source (LGPL)，Jspx.net Framework 使用LGPL 开源授权协议发布。
 * @jvm:jdk1.6+  x86/amd64
 *
 */
package com.jspx.boot.sign;

import com.jspx.utils.StringUtil;

/**
 * Created by IntelliJ IDEA.
 * User:chenYuan (mail:39793751@qq.com)
 * Date: 2005-11-10
 * Time: 9:46:52
 */
public abstract class UserType
{
    final public static int ADMINISTRATOR = 10;
    final public static int MANAGER = 6;
    final public static int INTENDANT = 4;
    final public static int USER = 2;
    final public static int NONE = 0;

    private UserType()
    {

    }
    /**
     * 0:游客
     * 2:普通用户
     * 4:普通管理员(不能登录后台)
     * 6:普通管理员(能登录后台)
     * 10:超级管理员
     */
    /**
     * @param type 类型
     * @return String
     */
    static public String toString(int type)
    {
        if (type == NONE) return "NONE";
        if (type == USER) return "USER";
        if (type == INTENDANT) return "INTENDANT";
        if (type == MANAGER) return "MANAGER";
        if (type == ADMINISTRATOR) return "ADMINISTRATOR";
        return StringUtil.empty;
    }

    static public int toInt(String type)
    {
        if (type.equalsIgnoreCase("NONE")) return NONE;
        if (type.equalsIgnoreCase("USER")) return USER;
        if (type.equalsIgnoreCase("INTENDANT")) return INTENDANT;
        if (type.equalsIgnoreCase("MANAGER")) return MANAGER;
        if (type.equalsIgnoreCase("ADMINISTRATOR")) return ADMINISTRATOR;
        return NONE;
    }
}